//
//  YinDaoYeView.m
//  PetTown
//
//  Created by lanou3g on 15/6/10.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "YinDaoYeView.h"

@implementation YinDaoYeView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setSubViews];
    }
    return self;
}

-(void)setSubViews{
    //设置引导页
    self.yinDaoScroll = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.yinDaoScroll.pagingEnabled = YES;
    self.yinDaoScroll.bounces = NO;
    self.yinDaoScroll.showsHorizontalScrollIndicator = NO;
    self.yinDaoScroll.contentSize = CGSizeMake(5*CGRectGetWidth(_yinDaoScroll.frame),CGRectGetHeight(_yinDaoScroll.frame));
    for (int i = 0; i< 5; i++) {
        UIImage * img = [UIImage imageNamed:[NSString stringWithFormat:@"yindaoye%d",i + 1]];
        UIImageView * imgView = [[UIImageView alloc] initWithImage:img];
        imgView.contentMode = UIViewContentModeScaleAspectFill;
        imgView.frame = CGRectMake(i*CGRectGetWidth(_yinDaoScroll.frame), 0, CGRectGetWidth(_yinDaoScroll.frame), CGRectGetHeight(_yinDaoScroll.frame));
        [_yinDaoScroll addSubview:imgView];
    }
    
    self.enterButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.enterButton.frame = CGRectMake(4*CGRectGetWidth(_yinDaoScroll.frame) + CGRectGetWidth(_yinDaoScroll.frame)/2 - 45, CGRectGetHeight(_yinDaoScroll.frame)/6 * 5, 90, 30);
    [_enterButton setBackgroundImage:[UIImage imageNamed:@"EnterButton.png"] forState:UIControlStateNormal];
    [_yinDaoScroll addSubview:_enterButton];
    [self addSubview:_yinDaoScroll];
}

@end
